Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a dependency check for cadence imports #5908

Merged
merged 4 commits into from
May 15, 2024

Conversation

janezpodhostnik
Copy link
Contributor

@janezpodhostnik janezpodhostnik commented May 14, 2024

ref: #5858

Add a dependency check to the FVM code.

If enabled the FVM will expect a function with the following signature:

access(all) fun checkDependencies(_ dependenciesAddresses: [Address], _ dependenciesNames: [String], _ authorizers: [Address]) { }

The FVM will call this function at the end of the transaction (after fee deduction). It will inject all dependencies of the transaction and all the authorizers of the transaction + the payer. The call of the function is not metered.

If the function is not there the FVM will quietly continue (It will log the problem).

If the function panics the transaction will fail (the panic message will be in the error). The function can emit events (but they will only be emitted if the transaction doesn't fail).

This is a v0.33 only feature

@janezpodhostnik janezpodhostnik self-assigned this May 14, 2024
@janezpodhostnik janezpodhostnik requested a review from ramtinms as a code owner May 14, 2024 13:02
@janezpodhostnik janezpodhostnik requested a review from a team May 14, 2024 13:02
@bluesign
Copy link
Contributor

what is the use case for this ?

@janezpodhostnik
Copy link
Contributor Author

There is a desire on testnet to report and potentially fail transactions that use unstaged contracts, to remind people that their contracts are not staged.

@janezpodhostnik janezpodhostnik changed the title Add a dependency check for cadecne imports Add a dependency check for cadence imports May 14, 2024
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea to consult the contract update staging contract and check that for all dependencies a contract has been staged?

@janezpodhostnik janezpodhostnik force-pushed the janez/dependency-check branch from 5d0fdaf to 395d26a Compare May 15, 2024 12:10
@janezpodhostnik
Copy link
Contributor Author

Is the idea to consult the contract update staging contract and check that for all dependencies a contract has been staged?

yes exactly.

That part will be implemented in the smart contract, which gives us greater flexibility and means that we do not have to use HCU to deploy changes.

@janezpodhostnik janezpodhostnik merged commit 90fe91c into v0.33 May 15, 2024
51 checks passed
@janezpodhostnik janezpodhostnik deleted the janez/dependency-check branch May 15, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants